If OCPN is starting after a crash, and the “Safe Mode” prompt pops up, selecting “YES” only disables plugin loading and that is all it does.
The “safe mode” logic was designed and implemented to protect against rogue plugins only, and that is all it is meant to do. No other run-time configurations should be affected by the choice of “yes” to the dialog.
Beware RPI 4: Answering “yes” rewrote the config file removing all chart locations.(currently, will be fixed in next release)
See the PR for Save Mode
Add a new command line option --safe_mode. (This CLI will also turn off OpenGL.) Check if last opencpn run failed and offer user to run in safe mode if so. In safe mode, disable plugin loading and OpenGL.
There are ideas to also block Connections in safe mode. This is not implemented.
This can save work!
On a regular basis, when O is going smoothly:
One example, when the “safe mode” has hit you :
O will rebuild database on next start, et voilà ! (not an ideal solution, but it works !)
Having the windows systems running (great tip is to use the batch script instead of the explorer.exe in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogo→Shell) we are using this batch script:
@echo off
Rem This script handles the startup and shutdown of OpenCPN. It takes care of config files and avoids OpenCPN asking for Safe Mode
:Start Rem Copy the the running config into place (D: is a SD Card Drive) IF EXIST D:\opencpn.ini (COPY /Y D:\opencpn.ini C:\ProgramData\opencpn\)
Rem If OpenCPN has failed, the startcheck.dat file will be there, so delete it. IF EXIST C:\ProgramData\opencpn\startcheck.dat (DEL C:\ProgramData\opencpn\startcheck.dat)
Rem Start OpenCPN in fullscreen and wait for exit START /D "C:\Program Files (x86)\OpenCPN" /REALTIME /WAIT /B C:"\Program Files (x86)"\OpenCPN\opencpn.exe /fullscreen
Rem Do we have a normal exit? IF %ERRORLEVEL% NEQ 0 ( Rem No ECHO OpenCPN exited abnormal with code %ERRORLEVEL% ) ELSE ( Rem Yes, so store away the working config file COPY /Y C:\ProgramData\opencpn\opencpn.ini D:\ ) Rem Restart after 5 seconds TIMEOUT /T 5 GOTO:Start
It would make some sense to compare the config files initially before copying them but my batch scripting is not that good.